# 测试 pytesseract 
import pytesseract  
from PIL import Image  
import cv2  

class PyTesseractUtil():

    def getText(self, picPath):

        gray = cv2.imread(picPath, 0)
        pil_image = Image.fromarray(gray) 

        text = pytesseract.image_to_string(pil_image, lang='eng')

        return text


if __name__ == '__main__':  
    util1 = PyTesseractUtil()
    txt1 = util1.getText('captcha.jpg')
    print(txt1)

